package com.zzzyh.forumsystemclient.dao;

import com.zzzyh.forumsystemclient.model.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    int insert(User row);

    int insertSelective(User row);

    User selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(User row);

    int updateByPrimaryKey(User row);

    User selectByUsername(String username);

    String selectSaltByUsername(String username);

    @Update("UPDATE t_message SET state = #{state}, update_time = NOW() WHERE id = #{id}")
    void updateState(@Param("id") Long id, @Param("state") Byte state);

    @Update("UPDATE t_message SET is_delete = 1, update_time = NOW() WHERE id = #{id}")
    void deleteById(Long id);
}